<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets">
<h:body styleClass="Corpo" style="font-size:13px;">


	<h:form id="formChAtenFiltro">
		<div align="center" class="DivCentralizada"
			style="left: 50%; margin-left: -550px; height: 120px; width: 1100px;">
			<h:panelGrid columns="8">
				<h:outputLabel value="#{message.msg_dataDe} " styleClass="LabelFont" />
				<p:inputMask value="#{gerenciaChamadoTela.dataDeFiltro}" size="5"
					maxlength="8" style="font-size: 14px;" mask="99/99/99"
					required="true">
				</p:inputMask>
				<h:outputLabel value=" #{message.msg_dataAte} "
					styleClass="LabelFont" />
				<p:inputMask value="#{gerenciaChamadoTela.dataAteFiltro}" size="5"
					maxlength="8" style="font-size: 14px;" mask="99/99/99"
					required="true">
				</p:inputMask>
				<h:outputLabel value="#{message.solicita_solicitante}"
					styleClass="LabelFont" style="margin-left:30px;" />
				<p:selectOneMenu value="#{gerenciaChamadoTela.solicitanteFiltro}"
					effect="fade" style="font-size: 13px;">
					<f:selectItem itemLabel="" itemValue="" />
					<f:selectItems value="#{gerenciaChamadoTela.solicitantesFiltro}"
						var="solicitante" itemLabel="#{solicitante.nome}"
						itemValue="#{solicitante.codigo}" style="font-size: 13px;" />
					<p:ajax global="false" />
				</p:selectOneMenu>
				<h:outputLabel value="#{message.label_responsavel}"
					styleClass="LabelFont" style="margin-left:30px;" />
				<p:selectOneMenu value="#{gerenciaChamadoTela.responsavelFiltro}"
					effect="fade" style="font-size: 13px;">
					<f:selectItem itemLabel="" itemValue="" />
					<f:selectItems value="#{gerenciaChamadoTela.responsaveisFiltro}"
						var="responsavel" itemLabel="#{responsavel.nome}"
						itemValue="#{responsavel.codigo}" style="font-size: 13px;" />
					<p:ajax global="false" />
				</p:selectOneMenu>
				<h:outputLabel value="#{message.label_destino}"
					rendered="#{usuario.tipo.equals('Gerente')}" styleClass="LabelFont"
					style="margin-left:30px;" />
				<p:selectOneMenu value="#{gerenciaChamadoTela.destinoChamadoFiltro}"
					rendered="#{usuario.tipo.equals('Gerente')}" effect="fade"
					style="font-size: 13px;"
					valueChangeListener="#{chamadoTela.buscaTipoProblemas}"
					immediate="true">
					<f:selectItem itemLabel="" itemValue="0" />
					<f:selectItems value="#{chamadoTela.destinoChamados}" var="destino"
						itemLabel="#{destino}" itemValue="#{destino}"
						style="font-size: 13px;" />
					<p:ajax update="idTpPAten" process="@form" />
				</p:selectOneMenu>


				<h:outputLabel value="#{message.label_assunto}"
					styleClass="LabelFont" style="margin-left:30px;" />
				<p:selectOneMenu id="idTpPAten"
					value="#{gerenciaChamadoTela.tipoChamadoFiltro}" effect="fade"
					style="font-size: 13px;"
					rendered="#{usuario.tipo.equals('Gerente')}">
					<f:selectItem itemLabel="" itemValue="0" />
					<f:selectItems value="#{chamadoTela.tipoProblemas}" var="tipo"
						itemLabel="#{tipo.descricao}" itemValue="#{tipo.codigo}"
						style="font-size: 13px;" />
					<p:ajax />
				</p:selectOneMenu>

				<p:selectOneMenu value="#{gerenciaChamadoTela.tipoChamadoFiltro}"
					effect="fade" style="font-size: 13px;"
					rendered="#{!usuario.tipo.equals('Gerente')}">
					<f:selectItem itemLabel="" itemValue="0" />
					<f:selectItems value="#{gerenciaChamadoTela.tipoProblemas}"
						var="tipo" itemLabel="#{tipo.descricao}"
						itemValue="#{tipo.codigo}" style="font-size: 13px;" />
					<p:ajax />
				</p:selectOneMenu>
				<h:outputLabel value="#{message.label_num_chamado}"
					styleClass="LabelFont" style="margin-left:30px;" />
				<p:inputText converterMessage="#{message.msg_conversao}"
					value="#{gerenciaChamadoTela.numeroChamadoFiltro}" />

				<h:outputLabel value="Todos Chamados?"
					rendered="#{usuario.tipo.equals('Gerente')}" styleClass="LabelFont"
					style="margin-left:30px;">
				</h:outputLabel>
				<p:selectBooleanCheckbox
					rendered="#{usuario.tipo.equals('Gerente')}"
					value="#{gerenciaChamadoTela.checkTodosChamados}"
					style="vertical-align: middle;">
					<p:ajax global="false" />
				</p:selectBooleanCheckbox>

			</h:panelGrid>

			<div style="margin-top: 10px; padding-left: 40px; float: left;">
				<p:commandButton value="#{message.botao_filtrar}"
					icon="ui-icon-search" style="margin-left:30px; font-size: 14px;"
					action="#{gerenciaChamadoTela.filtraAtendidos}"
					update=":formChAten,:messages" />
			</div>
		</div>
	</h:form>
	<h:form id="formChAten">
		<div align="left" style="padding-left: 3px; padding-top: 8px;">
			<p:dataTable var="chamado" id="idTChAten"
				value="#{gerenciaChamadoTela.chamadosAtendidos}"
				paginatorTemplate="{CurrentPageReport}  {FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
				rowsPerPageTemplate="10,15,20" rows="10" paginator="true"
				emptyMessage="#{message.msg_semvalores}"
				rowStyleClass="#{gerenciaChamadoTela.pintaLinha(chamado)}">

				<f:facet name="header">
					<div style="float: left;">
						<div style="padding-top: 2px; float: left">
							<h:outputText value="#{message.msg_legenda}  "
								style="font-size: 11px;" />
						</div>
						<p:graphicImage style="padding-left:10px" id="ate"
							value="img/negada.jpg" />
						<p:tooltip for="ate" value="#{message.label_atendido_nprazo}"
							showEffect="fade" hideEffect="fade" />

						<p:graphicImage style="padding-left:10px" id="and"
							value="img/comprada.jpg" />
						<p:tooltip for="and" value="#{message.label_atendido_prazo}"
							showEffect="fade" hideEffect="fade" />


						<p:graphicImage style="padding-left:10px" id="ins"
							value="img/recebida.jpg" />
						<p:tooltip for="ins" value="#{message.label_insatisfeito}"
							showEffect="fade" hideEffect="fade" />

					</div>

				</f:facet>


				<p:column style="width:4%">
					<p:rowToggler />
				</p:column>

				<p:column style="width:10%" sortBy="#{chamado.codigo}">
					<f:facet name="header">  
                    #{message.label_num_chamado} 
            		</f:facet>
					<h:outputText value="#{chamado.codigo}" />
				</p:column>

				<p:column style="width:10%"
					sortBy="#{chamado.tipoProblema.destinoChamado}">
					<f:facet name="header">  
                    #{message.label_destino} 
            		</f:facet>
					<h:outputText value="#{chamado.tipoProblema.destinoChamado}" />
				</p:column>

				<p:column style="width:10%"
					sortBy="#{chamado.tipoProblema.descricao}">
					<f:facet name="header">  
                    #{message.label_assunto} 
            		</f:facet>
					<h:outputText value="#{chamado.tipoProblema.descricao}" />
				</p:column>

				<p:column style="width:10%"
					sortBy="#{chamadoTela.converteData(chamado.dataEmissao)}">
					<f:facet name="header">  
                    #{message.solicita_dt_emissao} 
            		</f:facet>
					<h:outputText
						value="#{chamadoTela.converteData(chamado.dataEmissao)}" />
				</p:column>

				<p:column style="width:10%"
					sortBy="#{chamadoTela.converteData(chamado.dataPrevisao)}">
					<f:facet name="header">  
                    #{message.label_dt_previsao} 
            		</f:facet>
					<h:outputText
						value="#{chamadoTela.converteData(chamado.dataPrevisao)}" />
				</p:column>

				<p:column style="width:10%"
					sortBy="#{chamadoTela.converteData(chamado.dataAprovacao)}">
					<f:facet name="header">  
                    #{message.label_dt_aprova} 
            		</f:facet>
					<h:outputText
						value="#{chamadoTela.converteData(chamado.dataAprovacao)}" />
				</p:column>

				<p:column style="width:10%"
					sortBy="#{chamadoTela.converteData(chamado.dataEncerrado)}">
					<f:facet name="header">  
                    #{message.label_dt_finalizado} 
            		</f:facet>
					<h:outputText
						value="#{chamadoTela.converteData(chamado.dataEncerrado)}" />
				</p:column>



				<p:rowExpansion>

					<div style="margin-top: 30px;">
						<div style="float: left; padding-left: 8px;">
							<h:panelGrid columns="2" cellpadding="1" style="width:300px;"
								columnClasses="label, value">

								<h:outputText style="font-weight: bold;"
									value="#{message.solicita_solicitante}" />

								<h:outputText value="#{chamado.usuario.nome}" />

								<h:outputText style="font-weight: bold;"
									value="#{message.solicita_filial}" />

								<h:outputText
									value="#{chamado.usuario.filial.filial} (#{chamado.usuario.filial.descricao}) " />

								<h:outputText style="font-weight: bold;"
									value="#{message.header_qualifica_chamado}" />

								<h:outputText value="#{chamado.qualificacao}" />

								<h:outputText style="font-weight: bold;"
									value="#{message.label_nota}" />

								<p:rating value="#{chamado.notaChamado}" readonly="true"
									disabled="true" />

								<h:outputText style="font-weight: bold;"
									value="#{message.produto_observa} do #{message.solicita_solicitante}" />

								<h:outputText value="#{chamado.obsQualifica}" />

								<h:outputText style="font-weight: bold;" value="Ramal" />
								
								<h:outputText value="#{chamado.ramal}" />

								<h:outputText style="font-weight: bold;"
									value="#{message.label_email}" />

								<h:outputText value="#{chamado.usuario.email}" />

								<h:outputText style="font-weight: bold;"
									value="#{message.label_num_chamado} #{message.label_anterior}"
									rendered="#{chamado.chamadoAnterior.codigo != 0}" />

								<h:outputText value="#{chamado.chamadoAnterior}"
									rendered="#{chamado.chamadoAnterior.codigo != 0}" />


							</h:panelGrid>
						</div>
						<div style="float: left; margin-left: 30px;">
							<h:panelGrid columns="1" cellpadding="1"
								style="width:700px;center;">
								<h:outputText style="font-weight: bold;"
									value="#{message.label_comentario}" />
								<h:outputText escape="false" value="#{chamado.descricao}" />
								<h:outputText style="font-weight: bold;"
									value="#{message.label_responsavel}" />
								<h:outputText escape="false"
									value="#{chamado.usuarioResponsavel.nome}" />

							</h:panelGrid>
						</div>

					</div>


				</p:rowExpansion>
				<f:facet name="footer">
					<div style="float: left;">
						<div style="padding-top: 2px; float: left">
							<h:outputText value="#{message.msg_legenda}  "
								style="font-size: 11px;" />
						</div>
						<p:graphicImage style="padding-left:10px" id="ate2"
							value="img/negada.jpg" />
						<p:tooltip for="ate2" value="#{message.label_atendido_nprazo}"
							showEffect="fade" hideEffect="fade" />

						<p:graphicImage style="padding-left:10px" id="and2"
							value="img/comprada.jpg" />
						<p:tooltip for="and2" value="#{message.label_atendido_prazo}"
							showEffect="fade" hideEffect="fade" />


						<p:graphicImage style="padding-left:10px" id="ins2"
							value="img/recebida.jpg" />
						<p:tooltip for="ins2" value="#{message.label_insatisfeito}"
							showEffect="fade" hideEffect="fade" />

					</div>

				</f:facet>
			</p:dataTable>
		</div>
	</h:form>
</h:body>

</html>
